package distribution

import (
	"activity_srv/activityclient"
	"api/internal/respons"
	"api/internal/svc"
	"api/internal/types"
	"context"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetGeneratePosterLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetGeneratePosterLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGeneratePosterLogic {
	return &GetGeneratePosterLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

// GetGeneratePoster 获取分销海报
func (l *GetGeneratePosterLogic) GetGeneratePoster(req *types.GetGeneratePosterReq) (resp *types.Response, err error) {
	generatePoster, err := l.svcCtx.ActivityRpc.GetGeneratePoster(l.ctx, &activityclient.GetGeneratePosterReq{})
	if err != nil {
		return respons.Error(400, "服务端错误", err.Error()), err
	}

	return respons.Success(generatePoster), nil
}
